package io.focus.mijin.zuul.ratelimit.config;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Date;

/**
 * Represents a view of rate limit in a giving time for a user. <p> limit - How many requests can be executed by the
 * user. Maps to X-RateLimit-Limit header remaining - How many requests are still left on the current window. Maps to
 * X-RateLimit-Remaining header reset - Epoch when the rate is replenished by limit. Maps to X-RateLimit-Reset header
 *
 * @author Marcos Barbero
 * @author Liel Chayoun
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class Rate {

    private String key;

    private Long remaining;

    private Long remainingQuota;

    private Long reset;

    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "dd-MM-yyyy HH:mm:ss")
    private Date expiration;

}
